package com.xxkj.drugtraceability.ui.login

import com.xxkj.drugtraceability.base.BaseRepository
import com.xxkj.drugtraceability.bean.*
import com.xxkj.drugtraceability.net.WanService
import com.xxkj.drugtraceability.net.Result
import com.xxkj.drugtraceability.net.WanService.Companion.BASE_URL_API

/**
 * author: zhoujingjin
 * created on: 2024/9/9 16:55
 * description:
 */
class LoginRepository(var wanService: WanService):BaseRepository() {

    /**
     * 获取验证码
     */
    suspend fun getCode(): Result<ImageCodeBean> {
        return safeApiCall { executeResponse(wanService.getImageCode()) }
    }
    /**
     * 登录
     */
    suspend fun login( request: String): Result<BaseData<LoginBean>> {
        return safeApiCall { executeResponse(wanService.login(request)) }
    }

    /**
     * 获取用户信息
     */
    suspend fun getUserInfo(): Result<BaseData<UserBean>> {
        return safeApiCall { executeResponse(wanService.getUserInfo()) }
    }

    /**
     * 设备检测
     */
    suspend fun checkEquipment(pdaEquipmentApiDto: String): Result<Any> {
        return safeApiCall { executeResponse(wanService.checkEquipment(pdaEquipmentApiDto)) }
    }
}